package com.zyl.pts.web.controller;

import com.zyl.pts.config.anno.SystemLog;
import com.zyl.pts.config.enums.CodeAndMessageEnum;
import com.zyl.pts.config.result.Result;
import com.zyl.pts.service.AnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version v1.0
 * @ProjectName: product_source
 * @Package: com.zyl.pts.web.controller
 * @ClassName: AnalysisController
 * @Description TODO(首页大屏控制层)
 * @Author 翟玉龙
 * @Date 2024/11/18-14:16
 */
@Tag(name = "首页大屏", description = "首页大屏")
@RestController
@RequestMapping("/analysis")
public class AnalysisController {
    private final Logger log = LoggerFactory.getLogger(AnalysisController.class);

    private final AnalysisService analysisService;

    public AnalysisController(AnalysisService analysisService) {
        this.analysisService = analysisService;
    }

    /**
     * 统计栏舍，栏圈，动物数量，冷库数量，员工数量信息接口
     * @return {@link Result }<{@link ? }>
     */
    @SystemLog(business = "统计栏舍，栏圈，动物数量，冷库数量，员工数量信息接口")
    @Operation(summary = "统计栏舍，栏圈，动物数量，冷库数量，员工数量信息接口")
    @GetMapping("/count")
    public Result<?> getCount() {
        return Result.success(
                CodeAndMessageEnum.SUCCESS,
                analysisService.getCount()
        );
    }

    /**
     * 统计动物体重信息接口
     * @return {@link Result }<{@link ? }>
     */
    //@SystemLog(business = "统计动物体重信息接口")
    @Operation(summary = "统计动物体重信息接口")
    @GetMapping("/indexCount")
    public Result<?> getIndexCount() {
        return Result.success(
                CodeAndMessageEnum.SUCCESS,
                analysisService.getIndexCount()
        );
    }

    /**
     * 统计动物病症数量接口
     * @return {@link Result }<{@link? }>
     */
    //@SystemLog(business = "统计动物病症数量接口")
    @Operation(summary = "统计动物病症数量接口")
    @GetMapping("/countDisease")
    public Result<?> getDiseaseCount() {
        return Result.success(
                CodeAndMessageEnum.SUCCESS,
                analysisService.getDiseaseCount()
        );
    }

    /**
     * 统计本年度12个月销售动物接口
     * @return {@link Result }<{@link? }>
     */
    //@SystemLog(business = "统计本年度12个月销售动物接口")
    @Operation(summary = "统计本年度12个月销售动物接口")
    @GetMapping("/countSales")
    public Result<?> getAnimalCount() {
        return Result.success(
                CodeAndMessageEnum.SUCCESS,
                analysisService.getSaleCount()
        );
    }
}
